pp108 : onadditem Event

onadditem Event


This event is fired when a tree item is added to the tree.

Syntax

Inline HTML

<div cordysType="wcp.library.ui.Tree" id=treeID treeData=treeDataID treeSchema=treeSchemaID onadditem="handler()" >
...
</div>

Event Property

treeID.onadditem = handler


Event Information

To invoke


  • Add an item in the tree usingtreeDataafter setting atreeSchema.
  • Add an item in the tree from backend data usingbusDataIslandproperty.
  • Add an item by calling the functionaddItem.

Default Action

Adds an item to the tree and initiates any action associated with this event.


Event Object Properties


Although event handlers in the DHTML Object Model do not receive parameters directly, a handler can query an event object for data.

Property

Description

treeItem

Read-only. Object that denotes the tree Item that is currently added.


Example


The following example shows how the event is used to set a tool tip for an item added in the tree.

<!-- tree definition inside the BODY tag -->
<!-- sampleSchema denotes the schema defined and sampleData denotes the data to be shown in tree -->
<div cordysType="wcp.library.ui.Tree"  id="sampletree" treeSchema="sampleSchema" treeData="sampleData" onadditem="setTooltip()">
</div>
//Function called on onadditem
function setTooltip()
{
    var item = window.event.treeItem;
    //Set tooltip
    item.title = "This is a sample tool tip";
}

See Also


tree, treeData, treeSchema, busDataIsland, addItem